package com.crm.business.agreement.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.crm.business.agreement.mapper.BillAgreementTemplateSignerMapper;
import com.crm.business.agreement.service.IBillAgreementTemplateSignerService;
import com.crm.business.servlet.BaseServiceImpl;
import com.crm.common.agreement.entity.PO.BillAgreementTemplateParams;
import com.crm.common.agreement.entity.PO.BillAgreementTemplateSigner;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class BillAgreementTemplateSignerServiceImpl extends BaseServiceImpl<BillAgreementTemplateSignerMapper, BillAgreementTemplateSigner> implements IBillAgreementTemplateSignerService {

    @Override
    public int addList(List<BillAgreementTemplateSigner> list){

        for(BillAgreementTemplateSigner params : list){
            getBaseMapper().insert(params);
        }
        return list.size();
    }

    @Override
    public int deleteByTemplateId(Long templateId){
        LambdaQueryWrapper<BillAgreementTemplateSigner> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(BillAgreementTemplateSigner::getTemplateId, templateId);
        int i = getBaseMapper().delete(wrapper);
        return i;
    }
}
